﻿// -----------------------------------------------------------------------
// <copyright file="IResourceManager.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace WpfDevelopment.MVVM
{
    using System.Diagnostics.CodeAnalysis;
    using System.Globalization;
    using System.Reflection;
    using System.Resources;

    /// <summary>
    /// Wrapper around resourcemanager to allow mocking
    /// </summary>
    [ExcludeFromCodeCoverage]
    public class ResourceManagerWrapper : IResourceManager
    {
        private ResourceManager resourceManager;

        public void Init(string baseName, Assembly assembly)
        {
            this.resourceManager = new ResourceManager(baseName, assembly);
        }

        public ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
        {
            return this.resourceManager.GetResourceSet(culture, createIfNotExists, tryParents);
        }

        public string GetString(string name)
        {
            return this.resourceManager.GetString(name);
        }

        public void ReleaseAllResources()
        {
            this.resourceManager.ReleaseAllResources();
        }
    }
}
